<template>
  <el-button type="danger" @click="updateNum">增加</el-button>
  <el-button  @click="deleteEvent">删除事件总线</el-button>
  <el-backtop></el-backtop>
  <h1>
    {{filter(counter.count)}}
  </h1>


</template>

<script setup>
import Store from '../store/index'
import { getCurrentInstance} from 'vue'
import elementUi from "element-plus";
// let { proxy } = getCurrentInstance();
const counter = Store();


const updateNum = () => {
  $eventBus.emit('updateNum')
  console.log(counter.count);
}


const filter = (value) =>{
  if (value===0){
    return "7878"
  } else  {
    return "123"
  }
}

const deleteEvent = () => {
  $eventBus.off('updateNum')
}






</script>

<style scoped>

</style>